Créer les figures interactives demande aussi un certain temps de logiciel. Je vais donc les créer et les sauvegarder dans un format interactif (.rds) et je pourrai ainsi appeller les figures directement dans l’interface Shiny sans avoir à les créer dans l’interface. Ce sera plus rapide comme rendu ET l’interface Shiny sera simplifiée.
#Open the datasets
max <- read.csv("data/max.csv")
min <- read.csv("data/min.csv")
min$Year <- factor(min$Year)
max$Year <- factor(max$Year)
max$Route <- factor(max$Route)
#Rename Route
max$Route <- ifelse(max$Route=="IM_L", "IMM-Lactation",
ifelse(max$Route=="IM_T", "IMM-Tarissement",
ifelse(max$Route=="INJ", "Injectable",
ifelse(max$Route=="IU", "IU",
ifelse(max$Route=="ORAL", "PO", "Topique")))))
library(plotly)
## Le chargement a nécessité le package : ggplot2
##
## Attachement du package : 'plotly'
## L'objet suivant est masqué depuis 'package:ggplot2':
##
## last_plot
## L'objet suivant est masqué depuis 'package:stats':
##
## filter
## L'objet suivant est masqué depuis 'package:graphics':
##
## layout
fig_tot <- plot_ly(min,
y = ~total_DCD,
color = ~Year,
type = "box",
marker=list(color="white"))%>% #Remove markers for outlier
layout(title = 'Utilisation totale',
yaxis = list(title = "Taux d'utilisation (Traitement/100 animaux-année)",
hoverformat = '.0f',
range = list(0, 600)), #Adjust the y axis range
showlegend = FALSE)%>%
plotly_build()
saveRDS(fig_tot, "Figures/Total AMU.rds")
d <- readRDS("Figures/Total AMU.rds")
d
Taux d’utilisation des antibiotiques.
fig_cat1 <- plot_ly(min,
y = ~cat1_DCD,
color = ~Year,
type = "box",
marker=list(color="white"))%>% #Remove markers for outlier
layout(title = 'Utilisation des antibiotiques de catégorie I',
yaxis = list(title = "Taux d'utilisation (Traitement/100 animaux-année)",
hoverformat = '.0f',
range = list(0, 150)), #Adjust the y axis range
showlegend = FALSE)%>%
plotly_build()
saveRDS(fig_cat1, "Figures/Cat1 AMU.rds")
d <- readRDS("Figures/Cat1 AMU.rds")
d
fig_cat2 <- plot_ly(min,
y = ~cat2_DCD,
color = ~Year,
type = "box",
marker=list(color="white"))%>% #Remove markers for outlier
layout(title = 'Utilisation des antibiotiques de catégorie II',
yaxis = list(title = "Taux d'utilisation (Traitement/100 animaux-année)",
hoverformat = '.0f',
range = list(0, 300)), #Adjust the y axis range
showlegend = FALSE)%>%
plotly_build()
saveRDS(fig_cat2, "Figures/Cat2 AMU.rds")
d <- readRDS("Figures/Cat2 AMU.rds")
d
fig_cat3 <- plot_ly(min,
y = ~cat3_DCD,
color = ~Year,
type = "box",
marker=list(color="white"))%>% #Remove markers for outlier
layout(title = 'Utilisation des antibiotiques de catégorie III',
yaxis = list(title = "Taux d'utilisation (Traitement/100 animaux-année)",
hoverformat = '.0f',
range = list(0, 70)), #Adjust the y axis range
showlegend = FALSE)%>%
plotly_build()
saveRDS(fig_cat3, "Figures/Cat3 AMU.rds")
d <- readRDS("Figures/Cat3 AMU.rds")
d
fig_tot_route <- plot_ly(max,
x = ~Route,
y = ~total_DCD,
color = ~Year,
type = "box",
marker=list(color="white"))%>%
layout(boxmode="group",
title = "Utilisation totale par voie d'administration",
yaxis = list(title = "Taux d'utilisation (Traitement/100 animaux-année)",
hoverformat = '.1f',
range = list(0, 300)),
xaxis = list(title = "Voie d'administration"),
legend= list(x = 0.2,
y = 0.95,
orientation="h"))%>%
plotly_build()
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
saveRDS(fig_tot_route, "Figures/Total AMU Route.rds")
d <- readRDS("Figures/Total AMU Route.rds")
d
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
fig_cat1_route <- plot_ly(max,
x = ~Route,
y = ~cat1_DCD,
color = ~Year,
type = "box",
marker=list(color="white"))%>%
layout(boxmode="group",
title = "Utilisation des antibiotiques de catégorie I par voie d'administration",
yaxis = list(title = "Taux d'utilisation (Traitement/100 animaux-année)",
hoverformat = '.1f',
range = list(0, 130)),
xaxis = list(title = "Voie d'administration"),
legend= list(x = 0.2,
y = 0.95,
orientation="h"))%>%
plotly_build()
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
saveRDS(fig_cat1_route, "Figures/Cat1 AMU Route.rds")
d <- readRDS("Figures/Cat1 AMU Route.rds")
d
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
fig_cat2_route <- plot_ly(max,
x = ~Route,
y = ~cat2_DCD,
color = ~Year,
type = "box",
marker=list(color="white"))%>%
layout(boxmode="group",
title = "Utilisation des antibiotiques de catégorie II par voie d'administration",
yaxis = list(title = "Taux d'utilisation (Traitement/100 animaux-année)",
hoverformat = '.1f',
range = list(0, 220)),
xaxis = list(title = "Voie d'administration"),
legend= list(x = 0.2,
y = 0.95,
orientation="h"))%>%
plotly_build()
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
saveRDS(fig_cat2_route, "Figures/Cat2 AMU Route.rds")
d <- readRDS("Figures/Cat2 AMU Route.rds")
d
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
fig_cat3_route <- plot_ly(max,
x = ~Route,
y = ~cat3_DCD,
color = ~Year,
type = "box",
marker=list(color="white"))%>%
layout(boxmode="group",
title = "Utilisation des antibiotiques de catégorie III par voie d'administration",
yaxis = list(title = "Taux d'utilisation (Traitement/100 animaux-année)",
hoverformat = '.1f',
range = list(0, 120)),
xaxis = list(title = "Voie d'administration"),
legend= list(x = 0.2,
y = 0.95,
orientation="h"))%>%
plotly_build()
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
saveRDS(fig_cat3_route, "Figures/Cat3 AMU Route.rds")
d <- readRDS("Figures/Cat3 AMU Route.rds")
d
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
J’ai trouvé ces figures qui permettraient de présenter AMU par molécule…
#I don't know why but "Year" is always showing up in the bottom part of the figure, even with xaxis=list(title="Année")
min$Année <- factor(min$Year)
#Categorie 1
library(plotly)
fig <- plot_ly(min,
x = ~Année,
y = ~POLYMYXINB_SULF_DCD,
type = 'box',
name="Polymixine B",
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~CEFTIOFUR_DCD,
type = 'box',
name="Ceftiofur",
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~DANOFLOXACIN_DCD,
type = 'box',
name="Danofloxacin",
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~ENROFLOXACIN_DCD,
type = 'box',
name="Enrofloxacin",
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~MARBOFLOXACIN_DCD,
type = 'box',
name="Marbofloxacin",
marker=list(color="white")
)
fig.cat1.mol <- fig %>%
layout(boxmode="group",
title = 'Utilisation des antibiotiques de catégorie I par molécule',
yaxis = list(title = "Taux d'utilisation (Traitement/100 animaux-année)",
hoverformat = '.1f',
range = list(0, 90)) #Adjust the y axis range
)%>%
plotly_build()
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
saveRDS(fig.cat1.mol, "Figures/Cat1 AMU Molecule.rds")
d <- readRDS("Figures/Cat1 AMU Molecule.rds")
d
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
Partie 1 de 2
#Categorie 2
fig <- plot_ly(min,
x = ~Année,
y = ~BENZYLPENICILLIN_P_DCD,
name = 'Benzylpenicilline P',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~DIHYDROSTREPTOMYCIN_DCD,
name = 'Dihydrostreptomycine',
type="box",
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~CEFAPIRIN_DCD,
name = 'Céphapirine',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~CLOXACILLIN_DCD,
name = 'Cloxacilline',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~PIRLIMYCIN_DCD,
name = 'Pirlimycine',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~BENZYLPENICILLIN_B_DCD,
name = 'Benzylpenicilline B',
type = 'box',
marker=list(color="white")
)
fig.cat2a.mol <- fig %>%
layout(boxmode="group",
title = 'Utilisation des antibiotiques de catégorie II par molécule (partie 1/2)',
yaxis = list(title = "Taux d'utilisation (Traitement/100 animaux-année)",
hoverformat = '.1f',
range = list(0, 160)) #Adjust the y axis range
)%>%
plotly_build()
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
saveRDS(fig.cat2a.mol, "Figures/Cat2a AMU Molecule.rds")
d <- readRDS("Figures/Cat2a AMU Molecule.rds")
d
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
PArtie 2 de 2
#Categorie 2
fig <- plot_ly(min,
x = ~Année,
y = ~TRIM_SULFADOXINE_DCD,
name = 'Trimethoprim-sulfa',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~AMPICILLIN_DCD,
name="Ampicilline",
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~TULATHROMYCIN_DCD,
name = 'Tulathromycine',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~TILDIPIROSIN_DCD,
name = 'Tildipirosine',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~TILMICOSIN_DCD,
name = 'Tilmicosine',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~TYLOSIN_DCD,
name = 'Tylosine',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~NEOMYCIN_SULF_DCD,
name = 'Neomycine',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~STREPTOMYCIN_SULF_DCD,
name = 'Streptomycine',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~GAMITROMYCIN_DCD,
type = 'box',
name="Gamitromycine",
marker=list(color="white")
)
fig.cat2b.mol <- fig %>%
layout(boxmode="group",
title = 'Utilisation des antibiotiques de catégorie II par molécule (partie 2/2)',
yaxis = list(title = "Taux d'utilisation (Traitement/100 animaux-année)",
hoverformat = '.1f',
range = list(0, 20)) #Adjust the y axis range
)%>%
plotly_build()
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
saveRDS(fig.cat2b.mol, "Figures/Cat2b AMU Molecule.rds")
d <- readRDS("Figures/Cat2b AMU Molecule.rds")
d
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
#Categorie 3
fig <- plot_ly(min,
x = ~Année,
y = ~OXYTETRACYCLINE_DCD,
name = 'Oxytetracycline',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~CHLORTETRACYCLINE_DCD,
name="Chlortetracycline",
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~TETRACYCLINE_DCD,
name = 'Tetracycline',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~SULFATHIAZOLE_DCD,
name = 'Sulfathiazole',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~SUCCINYLSULFATHIAZOLE_DCD,
name = 'Succinyl Sulfathiazole',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~SULFAGUANIDINE_DCD,
name = 'Sulfaguanidine',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~SULFAMERAZINE_DCD,
name = 'Sulfamerazine',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~SULFAMETHAZINE_DCD,
name = 'Sulfamethazine',
type = 'box',
marker=list(color="white")
)
fig <- fig %>% add_trace(min,
x = ~Année,
y = ~SULFANILAMIDE_DCD,
name = 'Sulfanilamide',
type = 'box',
marker=list(color="white")
)
fig.cat3.mol <- fig %>%
layout(boxmode="group",
title = 'Utilisation des antibiotiques de catégorie III par molécule',
yaxis = list(title = "Taux d'utilisation (Traitement/100 animaux-année)",
hoverformat = '.1f',
range = list(0, 20)) #Adjust the y axis range
)%>%
plotly_build()
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
saveRDS(fig.cat3.mol, "Figures/Cat3 AMU Molecule.rds")
d <- readRDS("Figures/Cat3 AMU Molecule.rds")
d
## Warning: 'layout' objects don't have these attributes: 'boxmode'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'